{assign var='header' value='header2'}
{include file="top.html"}
<script src="{url('/style/jquery.ajaxContent.pack.js')}" type="text/javascript"></script>
<link rel="stylesheet" href="/style/mobile/css/member.css">
<link rel="stylesheet" href="/style/mobile/css/minfo.css">
<div id="content" class="container main space">
    <div class="shead">
        <div class="mpic"><img src="{zz mod=photo source=$member.photo nopic='/upload/photo.jpg'}" width="100" height="100" /><i></i></div>
        <dl class="sinfo">
            <dt>{$member.username|nickname:$member.nickname}</dt>
            <dd>
                {if $member.intro}<p>{$member.intro}</p>{/if}
                <p><b>ID：{sprintf('1%06d',$member.mid)} {$member.ip|cityIp}</b></p>
                <p>{$smarty.const.RootUrl}minfo?id={$member.mid}</p>
                <p><b style="font-size:1.8rem;">经验值：<span>{$member.rank_points}</span> <span>{$member.member_rank}</span></b></p>
                <p>还差{$member.level_upgrade}经验值即可升级到{$member.level_upgrade_name}</p>
            </dd>
        </dl>
        <div class="shr">
            {if $smarty.session.mid neq $member.mid}
            <div class="sbtn">
                {if $isfri gt 0}
                <a href="javascript:;" onclick="addFri('{$member.mid}')" id="Fri" class="at">解除好友</a>
                {else}
                <a href="javascript:;" onclick="addFri('{$member.mid}')" class="ab sbtn_fri" id="Fri"><span>加好友</span></a>
                {/if}
                <span></span>
                <a href="{'/member/message?mid='|cat:$smarty.get.id}" class="ab sbtn_msg"><span>发私信</span></a>
            </div>
            {/if}
        </div>
    </div>

    <div class="snav">
        <ul class="ui-clr">
            <li class="li_db hover" onclick="mLoad('db')">{$L.unit_yun}记录</li>
            <li class="li_dbCod" onclick="mLoad('dbCod')">{$L.unit_yun}{$L.unit_winning}</li>
            <li class="li_share" onclick="mLoad('share')">晒单</li>
            <li class="li_fri" onclick="mLoad('fri')">好友</li>
            <li class="li_visit" onclick="mLoad('visit')">访客</li>
        </ul>
    </div>

    <div class="load" id="load_db"></div>
    <div class="load" id="load_dbCod"></div>
    <div class="load" id="load_auc"></div>
    <div class="load" id="load_aucCod"></div>
    <div class="load" id="load_share"></div>
    <div class="load" id="load_fri"></div>
    <div class="load" id="load_visit"></div>

    <div class="load" id="load_db_vid"></div>
    <div class="load" id="load_share_vid"></div>

</div>
<script type="text/javascript">
    var hash = 'db';
    var mid = "{if $member.mid}{$member.mid}{else}0{/if}";
    var isLoad = {
        "db":false,
        "dbCod":false,
        "auc":false,
        "aucCod":false,
        "share":false,
        "fri":false,
        "visit":false
    };

    if(location.hash){ hash = location.hash.substr(1); }
    mLoad(hash);

    function mLoad(hash, load){
        var arr=hash.split("#");
        var type = arr[0];

        var loadDiv = '#load_'+type;

        $('.snav li').removeClass('hover');
        $('.li_'+type).addClass('hover');
        $('.load').hide();

        var info = '';
        if(arr[1] != undefined){
            var arr2=arr[1].split("=");
            info = '?'+arr[1];
            loadDiv += '_'+arr2[0];
        }
        $(loadDiv).show();

        load=load?load:false;
        if('#load_'+type != loadDiv || isLoad[type] == false || load==true){
            $(loadDiv).html("拼命加载中...").load('/minfo/load_'+type+'/'+mid+info);
            if('#load_'+type == loadDiv) isLoad[type] = true;
        }

        location.href='minfo?id='+mid+'#'+hash;
    }

    //添加/解除好友
    function addFri(id){
        var D = { id:id };
        $.post('/minfo/addFri',D,function(data){
            if(data.error <= 0){
                location.reload();
            }else{
                var params = ' ';
                if(data.url){
                    params = function(){
                        location.href=data.url;
                    };
                }
                if(data.msg){ layer.alert(data.msg,8,params); }
            }
        },"json");
    }
</script>